package com.pzcnet.config;

import com.pzcnet.service.EventBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * Created by LK on 2017/9/15.
 */
@Configuration
@EnableScheduling
public class EventSchedulerConfig {

    @Autowired
    private EventBus eventBus;

    @Scheduled(fixedDelay = 500L)
    public void scanAndPublishEvent() {
        this.eventBus.scanAndPublishEvent();
    }

    @Scheduled(fixedDelay = 500L)
    public void scanAndProcessEvent() {
        this.eventBus.scanAndProcessEvent();
    }

    @Scheduled(fixedDelay = 4000L)
    public void scanAndRepeatPublishEvent() {
        this.eventBus.scanAndRepeatPublishEvent();
    }
}
